<?php
/**
 * Description of Config
 *
 * @author Rene
 */
    class Config 
    {
        public static $DEBUG = '';

        public static $LOG_FILE = '';

        public static $DB_LOCATION = "";
        public static $DB_USER = "";
        public static $DB_PASS = "";
        public static $DB_NAME = "";
                
        public static function ReadFile($inFileName)
        {            
            if(!file_exists($inFileName))
            {
                die("Config File wurde nicht gefunden");
            }
            
            $file = fopen($inFileName, "r");
            
            if(!$file)
            {
                die("Config File konnte nicht geöffnet werden");
            }
            
            while(!(feof($file) != null))
            {
                $line = fgets($file);
                
                if(!isset($line))
                    continue;
                        
                
                $line = explode (":", $line);
                
                if(trim(strtoupper($line[0])) == 'DB_LOCATION')
                    Config::$DB_LOCATION = trim($line[1]);
                
                if(trim(strtoupper($line[0])) == 'DB_USER')
                    Config::$DB_USER = trim($line[1]);
                
                if(trim(strtoupper($line[0])) == 'DB_PASS')
                    Config::$DB_PASS = trim($line[1]);
                
                if(trim(strtoupper($line[0])) == 'DB_NAME')
                    Config::$DB_NAME = trim($line[1]);
                
                if(trim(strtoupper($line[0])) == 'DEBUG')
                    Config::$DEBUG = trim($line[1]);
                
                if(trim(strtoupper($line[0])) == 'LOG_FILE')
                    Config::$LOG_FILE = trim($line[1]);
            }
            
            fclose($file);
        }
    }

?>
